class Solution {
public:
    int sumOddLengthSubarrays(vector<int>& arr) {
        int n = arr.size();
        int sum = 0;
        for(int i = 0;i < n;++i)
        {
            for(int j = 1;j + i <= n;j += 2)
            {
                int z = i + j - 1;
                for(i = 1; i <= z ; i++)
                sum += arr[i];
            }
        }
         return sum;
            }
};